const model  = require('../model/model');
const basedao=require('../basedao')



/* 添加行业 */
async function  daoAddIndustry (data){
	  	 let dd=new model.modelindustry(data)
		 return	dd.save()
}

/* 删除 */
async  function  daodeleteIndustry (data){
	let ss=new basedao.basedao(model.modelindustry)
	 return	ss.deletebyid(data)
}



/* 改 */
async  function  daoupdateIndustry (id,data){
	let ss=new basedao.basedao(model.modelindustry)
	return	ss.updatebyid(id,data)
}


/* 查询所有行业 */
const daoFindAllIndustry=async ()=>{
	   return model.modelindustry.find().then(res=>{return res}).catch(err=>{console.log(  "查询失败"+err)})
	} 

	/* 查询单个 */
	async  function  daoqueryOne (id){
		let ss=new basedao.basedao(model.modelindustry)
		return	ss.findbyid(id)
	}



	





module.exports={
	daoAddIndustry,daoFindAllIndustry,daoupdateIndustry,daodeleteIndustry,daoqueryOne
}
